<div class="subhead ">
  <div class="container mx-auto">
    <div class="log-settings float-right">
      <ul>
        <li><a href="javascript:Source.scrollBottom();"><span id="scroll-down"><i class="far fa-arrow-alt-circle-down"></i></span> <span class="hide-on-mobile">scroll down</span></a></li>
        <li><a href="javascript:Source.switchDateFormat();"><span id="swap-date">
              <i class="fa fa-toggle-on pointer-cursor" aria-hidden="true"></i></span> <span class="hide-on-mobile">local time</span></a></li>
        <li><%= link to: Routes.source_path(@conn, :clear_logs, @source) do %><i class="fas fa-broom"></i><span class="hide-on-mobile"> clear cache</span><% end %></li>
        <li><a href="mailto:support@logflare.app?Subject=Logflare%20Help" target="_top"><i class="fas fa-question-circle"></i> <span class="hide-on-mobile">help</a></span></li>
      </ul>
    </div>
    <h5>~/logs/<%= link @source.name, to: Routes.source_path(@conn, :show, @source), class: "text-primary" %>/rejected</h5>
  </div>
</div>
<div class="container mx-auto console-text">
  <ul id="logs-list" class="list-unstyled console-text-list" hidden>
    <%= if @logs do %>
      <%= @logs |> Enum.with_index |> Enum.map(fn {log_event, inx} -> %>
      <li>
        <mark class="log-datestamp" data-timestamp="<%= 1_000_000 * (DateTime.from_naive!(log_event.ingested_at, "Etc/UTC") |> DateTime.to_unix()) %>"><%= log_event.ingested_at %></mark>
        <%= log_event.pipeline_error.message %>
        <a class="metadata-link" data-toggle="collapse" href="#metadata-<%= inx %>"aria-expanded="false">
          log payload
        </a>
        <div class="collapse metadata" id="metadata-<%= inx %>">
          <pre class="pre-metadata"><code><%= JSON.encode!(log_event.params, pretty: true) %></code></pre>
        </div>
      </li>
    <% end) %>
  <% end %>
</ul>
<div
id="__phx-assigns__"
data-source-token="<%= @source.token %>"
</div>
  <script>
    document.addEventListener("DOMContentLoaded", async () => {
        await Source.initLogsUiFunctions({scrollTracker: true})
      })
  </script>
